﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data;
using System.Collections;

namespace MySimpleWCFService
{
    /// <summary>
    /// WCF Sample 
    /// Author: alep@ciklum.net
    /// </summary>
    public class Sample : ISample
    {

        /// <summary>
        /// Send Sample Data Item To Service
        /// </summary>
        /// <param name="dataObject">Data Item</param>
        /// <returns>Success</returns>
        public bool SendData(SampleData dataObject)
        {
            try
            {
                Diagnostic.Trace(dataObject.ToString());




                return true;
            }
            catch (Exception ex)
            {
                Diagnostic.TraceError(ex);
                throw ex;
            }
            
        }

        /// <summary>
        /// Send Sample Data Item To Service
        /// </summary>
        /// <param name="dataObject">Data Item</param>
        /// <param name="trace">Trace Information</param>
        /// <returns>Success</returns>
        public bool SendData(SampleData dataObject, TraceData trace)
        {
            try
            {
                trace.DepartureReceived = DateTime.Now;
                return this.SendData(dataObject);
            }
            finally
            {
                trace.ArrivalSent = DateTime.Now;
            }
        }
    }
}
